"""
作为包运行时的入口点
使用: python -m hiagent-app (从src/llm目录)
"""
from .services.app_service import AppService
from .services.personal_agent_service import PersonalAgentService
from .models.hiagent_models import ListOption

def main():
    print("\nHiAgent API 测试\n")
    print("="*60)

    # 测试应用中心
    print("\n[应用中心API]")
    app_service = AppService()
    try:
        categories = app_service.list_app_center_categories()
        print(f"获取分类: 成功 ({len(categories)} 个)")
    except Exception as e:
        print(f"获取分类: 失败 - {str(e)[:100]}")

    try:
        list_opt = ListOption(page=1, page_size=3)
        apps, total = app_service.list_app_center(list_opt)
        print(f"应用列表: 成功 (总数: {total})")
    except Exception as e:
        print(f"应用列表: 失败 - {str(e)[:100]}")

    # 测试个人智能体
    print("\n[个人智能体API]")
    personal_service = PersonalAgentService()
    try:
        list_opt = ListOption(page=1, page_size=3)
        agents, total = personal_service.list_personal_agents(list_opt)
        print(f"智能体列表: 成功 (总数: {total})")
    except Exception as e:
        print(f"智能体列表: 失败 - {str(e)[:100]}")

    print("\n" + "="*60)
    print("测试完成\n")

if __name__ == "__main__":
    main()
